<template>
  <div>
    <h2>欢迎光临==就坑你===</h2>
    <p>
      <strong>苹果{{ danjia }}￥/斤,折扣-{{ zhekou }}折- </strong>
    </p>
    <p>请输入你要购买的斤数 <input type="text" v-model.number="number" /></p>
    <button @click.prevent="submit">结账买单</button>
    <p>结账单:总价{{ sum }}￥元,折后:{{ zh }}元,省了:{{ s }}￥元</p>
  </div>
</template>

<script>
export default {
  data () {
    return {
      danjia: 10,
      zhekou: 8,
      number: 0,
      sum: 0,
      zh: 0,
      s: 0
    }
  },
  methods: {
    submit () {
      this.sum = this.danjia * this.number
      this.zh = this.danjia * this.zhekou * 0.1 * this.number
      this.s = this.sum - this.zh
    }
  }
}
</script>

<style></style>
